//-----------------------------------------------------------------------------
// File: ColorFormater.cs
//
// Copyright (c) Dmitry Shuklin. All rights reserved.
//-----------------------------------------------------------------------------
using System;

namespace ObjectiveDraw.Platform.Serialization
{
	/// <summary>
	/// Summary description for ColorFormater.
	/// </summary>
	public class ColorFormater : IPropertyFormatter
	{
		public ColorFormater()
		{
			//
			// TODO: Add constructor logic here
			//
		}
		#region IFieldFormatter Members

		public object SerializeValue(object value, object [] parameters)
		{
			return value==null?null:(object)((System.Drawing.Color)value).ToArgb();
		}

		public object DeserializeValue(object value, object [] parameters)
		{
			return value==null?null:(object)System.Drawing.Color.FromArgb((int)value);
		}

		#endregion
	}
}
